using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    public class BenchmarkListMap : EntityTypeConfiguration<BenchmarkList>
    {
        public BenchmarkListMap()
        {
            // Primary Key
            this.HasKey(t => t.Id);

            // Properties
            this.Property(t => t.Region)
                .IsRequired()
                .HasMaxLength(50);

            this.Property(t => t.Sector)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Ticker)
                .IsRequired()
                .HasMaxLength(500);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(500);

            // Table & Column Mappings
            this.ToTable("BenchmarkList", "MarketData");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Region).HasColumnName("Region");
            this.Property(t => t.Sector).HasColumnName("Sector");
            this.Property(t => t.Ticker).HasColumnName("Ticker");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.SecurityId).HasColumnName("SecurityId");

            // Relationships
            this.HasRequired(t => t.Security);

        }
    }
}
